package cn.maszy.action.contract;



import org.springframework.beans.factory.annotation.Autowired;

import net.sourceforge.stripes.action.SessionScope;
import cn.maszy.common.BaseAction;
import cn.maszy.model.contract.B_T_Ufp_Payment;
import cn.maszy.service.contract.B_T_Ufp_PaymentService;



@SessionScope
public class PaymentAction extends BaseAction<B_T_Ufp_Payment> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2475349243064011153L;
	private B_T_Ufp_Payment b_T_Ufp_Payment;
	private String b_T_Ufp_Contractuuid;
	@Autowired
	private B_T_Ufp_PaymentService b_T_Ufp_PaymentService;
	private String checkIds;
	
	/*********************class set/get****************************/
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}

	
	public String getB_T_Ufp_Contractuuid() {
		return b_T_Ufp_Contractuuid;
	}
	public void setB_T_Ufp_Contractuuid(String b_T_Ufp_Contractuuid) {
		this.b_T_Ufp_Contractuuid = b_T_Ufp_Contractuuid;
	}
	public B_T_Ufp_Payment getB_T_Ufp_Payment() {
		return b_T_Ufp_Payment;
	}
	public void setB_T_Ufp_Payment(B_T_Ufp_Payment b_T_Ufp_Payment) {
		this.b_T_Ufp_Payment = b_T_Ufp_Payment;
	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 页面查询
	 * @return
	 * @throws Exception
	 */
//	public String paymentList() throws Exception {
//		pager = new Pager<B_T_Ufp_Contract>(pageNum, numPerPage,orderField,orderDirection);
//		pager= b_T_Ufp_PaymentService.selectList(b_T_Ufp_Payment,pager);	
//		return SUCCESS;
//	}
	
	/**
	 * 新增更新
	 * @return
	 * @throws Exception
	 */
	public String paymentUpdate() throws Exception {
		int i	=b_T_Ufp_PaymentService.update(b_T_Ufp_Payment,b_T_Ufp_Contractuuid);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "adminList", "closeCurrent", "investment/adminList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "ContractRead", "", "forward", "contract/ContractRead?b_T_Ufp_Contract.uuid="+b_T_Ufp_Contractuuid+"&flag=2");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 页面跳转
	 * @return
	 * @throws Exception
	 */
	public String paymentJump() throws Exception {
		return SUCCESS;
	}
	/**
	 * 删除一条数据
	 * @return
	 * @throws Exception
	 */
	public String paymentDel() throws Exception {
		int i=b_T_Ufp_PaymentService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "ContractDetail", "", "forward", "contract/ContractDetail?b_T_Ufp_Contract.uuid="+b_T_Ufp_Contractuuid+"&flag=2");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询一条数据
	 * @return
	 * @throws Exception
	 */
	public String paymentDetail() throws Exception {
		if(b_T_Ufp_Payment==null){
			b_T_Ufp_Payment=b_T_Ufp_PaymentService.selectOne("");
		}else{
			b_T_Ufp_Payment=b_T_Ufp_PaymentService.selectOne(b_T_Ufp_Payment.getUuid());
		}
		return SUCCESS;
	}
}
